import request from '@/utils/request'

// 目录
export const rootPathHDFS = params => {
  return request({
    url: '/hdfs/home',
    method: 'get',
    params,
  })
}

//下载
export const getFile = params => {
  return request({
    url: '/hdfs/get',
    method: 'get',
    params,
    responseType: 'blob',
  })
}

// 重命名文件 修改文件路径
export const renameOrMvFile = params => {
  return request({
    url: '/hdfs/mv',
    method: 'get',
    params,
  })
}
//创建文件夹
export const creatDir = params => {
  return request({
    url: '/hdfs/createDir',
    method: 'get',
    params,
  })
}

//删除文件或者文件夹
export const remove = data => {
  return request({
    url: '/hdfs/rm',
    method: 'delete',
    data,
  })
}

//上传文件
export const UploadFile = (data, path, rewrite) => {
  return request({
    url: '/hdfs/upload?path=' + path + '&rewrite=' + rewrite,
    method: 'post',
    data,
  })
}
